DEVICE = pic16f84a
BURNER = /dev/ttyS0
SCRIPT = /usr/share/gputils/lkr/16f84a.lkr
OBJECTS = lmkbd.o symkbd.o routines.o
OUTPUT = lmkbd.hex

all:		$(OUTPUT)

$(OUTPUT):	$(OBJECTS) $(SCRIPT)
	gplink --map -c -s $(SCRIPT) -o $(OUTPUT) $(OBJECTS)

%.o:		%.asm
	gpasm -c $<

clean:
	rm -f *.o *.lst *.map *.hex *.cod *.cof disasm.txt

disasm:
	gpdasm -p $(DEVICE) $(OUTPUT) > disasm.txt

burn :
	picprog --device=$(DEVICE) --pic-serial-port=$(BURNER) --burn --input-hexfile=$(OUTPUT)

erase :
	picprog --device=$(DEVICE) --pic-serial-port=$(BURNER) --erase --burn

sim :
	gpsim -p p16f84 $(OUTPUT)

main.o:		lmkbd.asm common.asm pins.asm macros.asm

symkbd.o:	symkbd.asm symkeys.asm common.asm pins.asm macros.asm

routines.o:	routines.asm common.asm macros.asm
